<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of topic_model
 *
 * @author Administrator
 */
class topic_model extends CI_Model {
    function  __construct() {
        parent::__construct();
	    $this->load->database();
	    $this->_table="topic";
    }
    
    function get_all(){
      $query =  $this->db->get($this->_table);
      $data=$query->result();
      return $data;
    }
    
    function get_all_count(){
    	return	$this->db->count_all($this->_table);
    }
    
    function get_items($num, $offset,$col='topicid',$asc="desc"){
        $this->db->order_by($col, $asc); 
        $query = $this->db->get($this->_table, $num, $offset);
        $data=$query->result(); 
        return $data;
    }
    
    function get_item($key='topicid',$value){ 
        $query = $this->db->get_where($this->_table,array($key => $value)); 
        $data=$query->result(); 
        return $data;
    }
    
}
?>
